<template>
  <Header></Header>
  <van-pull-refresh v-model="loading" @refresh="onRefresh">
  <Sort></Sort>
  <Goods></Goods>
  </van-pull-refresh>
  <Tabbar></Tabbar>
</template>

<script setup>
import Tabbar from "@/components/common/Tabbar.vue";
import Header from "@/components/Home/Header.vue";
import Sort from "@/components/Home/Sort.vue";
import Goods from "@/components/Home/Goods.vue";
import axios from "axios";
import { ref, onMounted } from "vue";
import { showToast } from "vant";

const loading = ref(false);
const onRefresh = () => {
  setTimeout(() => {
    showToast("刷新成功");
    loading.value = false;
    count.value++;
  }, 500);
};

const sortList = ref([]);
onMounted(() => {
  fetchData();
});
const fetchData = async () => {
  const res = await axios.get("/api/index");
  console.log(res);
};
</script>
